<template>
  <!--<h1>首页</h1>-->
  <el-container class="home-container">
    <!--    头部-->
    <el-header>

      <div class="img_box">
        <img src="@/assets/image/bmob.png"  style="height: 25px;width: 100px;">
      </div>
      <div class="text_box">
        <el-container>
          <el-header style="text-align: right; font-size: 12px">
            <el-dropdown @command="handleCommand">
              <i style="margin-right: 15px" >王小虎</i>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item command="loginOut">退出登录</el-dropdown-item>

              </el-dropdown-menu>
            </el-dropdown>

          </el-header>

        </el-container>
      </div>

    </el-header>
    <!--    页面主题-->
    <el-container>
      <!--      侧边栏-->
      <el-aside width="200px">
        <el-menu
          background-color="#545c64"
          text-color="#fff"
          active-text-color="#589DF6" :router="true" default-active="activePath">
          <!--          一级菜单-->
          <el-submenu :index="item.id +''" v-for="item in menulist" v-bind:ket="item.id">
            <template slot="title">
              <!--              图标-->
              <i :class="iconsObj[item.id]"></i>
              <!--              文本-->
              <span>{{item.name}}</span>
            </template>
            <!--            二级菜单-->
            <el-menu-item :index="'/'+subItem.path" v-for="subItem in item.children" v-bind:key="subItem.id" @click="saveNavState('/'+subItem.path)">
              <template slot="title">
                <!--              图标-->
                <!--                <i class="el-icon-location"></i>-->
                <!--              文本-->
                <span>{{subItem.subname}}</span>
              </template>
            </el-menu-item>

          </el-submenu>


        </el-menu>
      </el-aside>
      <!--      右边区域-->
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
  export default {
    data(){
      return{
        menulist:[
          {name:"工作台",id:'1',children:[{subname:"我的工作台",id:'11',path:'workbench'}]},
          {name:"IPA",id:'2',children:[
              // addAccount
              {subname:"关联APP Store账户",id:'201',path:'associated'},
              {subname:"APP列表",id:'202',path:'appTabulation'},
              {subname:"IPA列表",id:'203',path:'ipaTabulation'}
            ]},
          {name:"设计",id:'3',children:[{subname:"我的设计",id:'13',path:'designPage'}]},
          {name:"BUG",id:'4',children:[{subname:"BUG",id:'14',path:'bugPage'}]},
          {name:"设置",id:'5',children:[
              {subname:"企业/组织",id:'501',path:'enterpriseOrganization'},
              {subname:"团队管理",id:'502',path:'teamManagement'},
              {subname:"个人信息",id:'503',path:'personalInformation'}
            ]},
        ],
        iconsObj:{
          '1':'el-icon-user-solid',
          '2':'el-icon-folder-opened',
          '3':'el-icon-brush',
          '4':'el-icon-question',
          '5':'el-icon-setting',
        },
        //记录点击路径 高亮状态
        activePath:''
      }


    },
    created() {
      this.activePath = window.sessionStorage.getItem('activePath')
      console.log('111111111111111111111111111')
      // this.getMenuList()
    },
    methods:{
      saveNavState(activePath){
        window.sessionStorage.setItem('activePath',activePath)
      },
      handleCommand(command){
        if (command==="loginOut"){
          this.$router.push("/login")
        }

      }
    },

    // async getMenuList(){
    // const {data:res} = await  this.$http.get('mens')
    // if(res.meta.status !== 200)return this.$message.error(res.meta.msg)
    // this.menulist = res.data
    // },
    name: "WorkbenchHome"
  }
</script>

<style scoped>
  .home-container{
    width: 100%;
    /*height: 100%;*/
    /*background-color: #F2F2F5;*/
  }
  .el-dropdown {
    margin-top: 20px;
  }
  .img_box{
    /*text-align: center;*/
    float: left;
    margin-top: 20px;
    margin-left: 3px;
  }
  .text_box{
    float: right;
    /*margin-top: 20px;*/
    margin-right: 10px;
  }
  /*el-dropdown-selfdefine{*/
  /*  transform: 50%;*/
  /*  margin-top: 10px;*/
  /*}*/
  .home-container{
    height: 100%;
  }
  .el-header{
    background-color:#D9D9D9;
  }
  .el-aside{
    background-color: #545c64;
  }
  .el-menu{
    border-right: 10px;
  }
  .el-icon-location{
    padding-left: 10px;
  }

  .el-main{
    /*background-color: #666666;*/
  }
</style>
